﻿<%@ Page Language="C#" MasterPageFile="~/FB.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="History_Default" Title="Untitled Page" %>
<%@ MasterType TypeName="FB" %>


<asp:Content ID="cHead" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="cMain" ContentPlaceHolderID="main" Runat="Server">

    <h2>A list of all the pranks you have sent.</h2>
    <br />

    <asp:GridView ID="gvStats" runat="server" DataSourceID="dsStats" 
        AutoGenerateColumns="False" DataKeyNames="id" CellPadding="4" 
        ForeColor="#333333" GridLines="None" 
        onselectedindexchanged="gvStats_SelectedIndexChanged">
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
            <asp:BoundField DataField="sent_on" HeaderText="Sent" />
            <asp:BoundField DataField="prank_text" HeaderText="Prank" />
            <asp:BoundField DataField="recipient_count" HeaderText="Recipients" />
            <asp:CommandField ShowSelectButton="True" SelectText="View recipients" />
        </Columns>
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    
    <br /><br />
    
    <asp:GridView ID="gvDetails" runat="server" CellPadding="4" ForeColor="#333333"
        GridLines="None" AutoGenerateColumns="false" >
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="#EFF3FB" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:ImageField DataImageUrlField="SquarePictureUrl" HeaderText="Recipients" />
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblFirstName" Text='<%#Bind("FirstName")%>' />
                    <asp:Label runat="server" ID="lblLastName" Text='<%#Bind("LastName")%>' />
                    <br />
                    <asp:Label runat="server" ID="lblBirthday" Text='<%#Bind("Birthday")%>' />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    

    <asp:Repeater ID="Repeater1" runat="server">
        <ItemTemplate>
            <asp:Label runat="server" Text='<%DataBinder.Eval(Container.DataItem,"Item")%>' />
        </ItemTemplate>
    </asp:Repeater>
    

    <asp:LinqDataSource ID="dsStats" runat="server" 
        ContextTypeName="DBDataContext" 
        Select="new (sender_id, sent_on, prank_text, recipient_count, id)" 
        TableName="sent_prank_stats" Where="sender_id == @sender_id">
        <WhereParameters>
            <asp:ControlParameter Name="sender_id" ControlID="fbapp" PropertyName="UserID" Type="Int64" />
        </WhereParameters>
    </asp:LinqDataSource>





</asp:Content>

